
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>还车列表</title>

    <link  href="/static/plugins/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="/static/plugins/bootstrap-table/bootstrap-table.css" rel="stylesheet" >
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/common.css">
    <style>
        .f1{
            float: left;
            margin-right: 30px;
        }
        .search{
            padding: 20px;
        }
    </style>


</head>
<body>
<div class="wrap-padding-15">

        <span class="layui-breadcrumb" >
           <a href="/" target="_top" style="font-size: 22px">首页</a>
           <a href="javascript:" style="font-size: 22px">还车列表</a>
        </span>

    <div class="search" style="margin-top: 10px">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-md1">
                <div class="layui-form-item">
                    <label class="layui-form-label">订单号：</label>
                    <div class="layui-input-block">
                        <input type="text" name="orderid"  id="orderid"  autocomplete="off" placeholder="请输入订单号">
                    </div>
                </div>
            </div>
            <div class="layui-col-md1 layui-col-md-offset2">
                <div class="layui-form-item">
                    <label class="layui-form-label">客户手机：</label>
                    <div class="layui-input-block">
                        <input type="text" name="mobile"  id="mobile"  autocomplete="off" placeholder="请输入客户手机号">
                    </div>
                </div>
            </div>

            <div class="layui-col-md1 layui-col-md-offset2">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <%--<button class="layui-btn" lay-submit lay-filter="formSubmit">查询</button>--%>
                        <button type="button" class="layui-btn" id="search">查询</button>

                    </div>
                </div>

            </div>
        </div>
    </div>

    <table id="tb_returncar"></table>
</div>

<script src="/static/plugins/jquery.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.js"></script>
<script src="/static/plugins/bootstrap-table/bootstrap-table.js"></script>
<script src="/static/plugins/bootstrap-table/bootstrap-table-zh-CN.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script>
    layui.use(['element','layer','form'],function () {
        var element = layui.element;
        var layer = layui.layer;
        var form = layui.form

        window.operateEvents = {
            'click .returncheck': function (e, value, row, index) {
                debugger
                location.href = "/returncar/returncheck?id="+row.id+"&carid="+row.carid

            }
        }

        $("#search").on('click',function (data) {

            var orderid = $("#orderid").val()
            var mobile = $("#mobile").val()

            $("#tb_returncar").bootstrapTable("refresh",{
                query:{
                    orderid:orderid,
                    mobile:mobile,
                }
            });
        })

        $("#tb_returncar").bootstrapTable({
                url: '/returncar/listData',         //请求后台的URL（*）
                method: 'get',                      //请求方式（*）
                toolbar: '#toolbar',                //工具按钮用哪个容器
                striped: true,                      //是否显示行间隔色
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                pagination: true,                   //是否显示分页（*）
                sortable: false,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                queryParams: function queryParamFun(data) {
                    var param = {
                        offset:data.offset,
                        limit:data.limit,
                    }
                    return param;
                },//传递参数（*）
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber:1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                //search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                strictSearch: true,
                showColumns: true,                  //是否显示所有的列
                showRefresh: true,                  //是否显示刷新按钮
                //minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: true,                //是否启用点击选中行
                height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
                uniqueId: "id",                     //每一行的唯一标识，一般为主键列
                //showToggle:true,                    //是否显示详细视图和列表视图的切换按钮
                //cardView: false,                    //是否显示详细视图
                detailView: false,                  //是否显示父子表

                columns:[{
                    checkbox: true
                },{
                    field: 'orderid',
                    title: '订单号',
                    align:'center',
                },{
                    field: 'mobile',
                    title: '客户手机',
                    align:'center',
                },{
                    field: 'name',
                    title: '客户姓名',
                    align:'center',
                },{
                    field: 'carbrand',
                    title: '车辆型号',
                    align:'center',
                },{
                    field: 'carcode',
                    title: '车牌号',
                    align:'center',
                },{
                    field: 'realettime',
                    title: '还车日期',
                    align:'center',
                    formatter:function (value, row, index) {
                        if(isNaN(value)){
                            return "--";
                        } else {
                            var time = new Date(value);
                            return time.toLocaleDateString().replace("/","-").replace("/","-");
                        }
                    }
                },{
                    field: 'operate',
                    title: '操作',
                    align:'center',
                    events: operateEvents,
                    formatter: operateFormatter
                },]
            })

        function operateFormatter(value, row, index) {
                return [
                    '<input type="submit" value="审核" class="returncheck"   data-toggle="modal" style="display:inline;color: #01AAED;width: 50px">',
                ].join('');
            }
    })

</script>
</body>
</html>